package cn.demoncat.util.ocr.huawei.entity;

import cn.demoncat.util.lang.entity.card.IdCard;

/**
 * 身份证
 *
 * @author 延晓磊
 * @since 2020年10月23日
 */
public class IdCardItem {

    // 姓名
    private String name;
    // 性别
    private String sex;
    // 民族
    private String ethnicity;
    // 出生日期
    private String birth;
    // 住址
    private String address;
    // 身份证号码
    private String number;

    // 发证机关（背面）
    private String issue;
    // 有效期限起始日期
    private String valid_from;
    // 有效期限结束日期
    private String valid_to;

    /**
     * 转换为通用对象
     *
     * @return
     */
    public IdCard toCommonData(){
        IdCard data = new IdCard();
        data.setAddress(this.getAddress());
        data.setBirth(this.getBirth());
        data.setEthnicity(this.getEthnicity());
        data.setIssue(this.getIssue());
        data.setName(this.getName());
        data.setNumber(this.getNumber());
        data.setSex(this.getSex().equals("男") ? "1" : "2");
        data.setValidFrom(this.getValid_from());
        data.setValidTo(this.getValid_to());
        return data;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getEthnicity() {
        return ethnicity;
    }

    public void setEthnicity(String ethnicity) {
        this.ethnicity = ethnicity;
    }

    public String getBirth() {
        return birth;
    }

    public void setBirth(String birth) {
        this.birth = birth;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getIssue() {
        return issue;
    }

    public void setIssue(String issue) {
        this.issue = issue;
    }

    public String getValid_from() {
        return valid_from;
    }

    public void setValid_from(String valid_from) {
        this.valid_from = valid_from;
    }

    public String getValid_to() {
        return valid_to;
    }

    public void setValid_to(String valid_to) {
        this.valid_to = valid_to;
    }
}
